/**
 * 全局状态管理
 */

import { createContext } from 'react'
import type { Locale } from '../i18n'

export interface AppState {
  locale: Locale
  apiKey: string
}

export interface AppContextType {
  state: AppState
  setLocale: (locale: Locale) => void
  setApiKey: (apiKey: string) => void
}

export const initialState: AppState = {
  locale: 'zh',
  apiKey: ''
}

export const AppContext = createContext<AppContextType>({
  state: initialState,
  setLocale: () => {},
  setApiKey: () => {}
})

